#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    int peakIndexInMountainArray(vector<int> &arr)
    {
        int l = 0, r = arr.size() - 1;
        while (l < r)
        {
            int mid = (l + r + 1) >> 1;
            if (arr[mid - 1] < arr[mid])
            {
                l = mid;
            }
            else
            {
                r = mid - 1;
            }
        }
        return l;
    }
};